package com.wd.base

import android.app.Application
import android.content.SharedPreferences
import com.hyphenate.chat.EMClient
import com.hyphenate.chat.EMOptions
import com.hyphenate.easeui.EaseIM
import com.tencent.mmkv.MMKV


/**
 * Created by Android Studio.
 * author: 张鸿羽
 * Date: 24/6/2024
 * Time: 上午9:10
 * 功能：全局可以sp数据库
 */
class App : Application(){
    companion object{
        lateinit var sp: SharedPreferences
        var userId=4255
        var sessionId="17295662878244255"
    }

    override fun onCreate() {
        super.onCreate()
        sp=getSharedPreferences("mySP", MODE_PRIVATE)

        //初始化环信
        val options = EMOptions()
        // 默认添加好友时，是不需要验证的，改成需要验证
        options.acceptInvitationAlways = false
        //1196240604175830#lookfor20
        options.appKey = "1196240604175830#lookfor20"
        if (EaseIM.getInstance().init(this, options)) {
        //在做打包混淆时，关闭debug模式，避免消耗不必要的资源
            EMClient.getInstance().setDebugMode(true)
        }

        //初始化MMKV
        MMKV.initialize(this)
    }
}